package omg.loot;

public class Shared {
   public static final double divider = 1000000; //Nano seconds to milliseconds divider
   public static double scaleX = 1; //Scale's for possible aspect ratio distortion
   public static double scaleY = 1;
   
   public static boolean collide(final double x1, final double y1, final double radius1, final double x2, final double y2, final double radius2) {
      final int dx = (int)(x2 - x1);
      final int dy = (int)(y2 - y1);
      final int radii = (int)(radius1 + radius2);
      if ((dx * dx)  + (dy * dy) < radii * radii)
         return true;
      else
         return false;
   }
   
   public static boolean collide(final Entity a, final Entity b) {
      final int dx = (int)(b.x - a.x);
      final int dy = (int)(b.y - a.y);
      final int radii = (int)(a.r + b.r);
      if ((dx * dx)  + (dy * dy) < radii * radii)
         return true;
      else
         return false;
   }
   
   public static float distance(final float startX, final float startY, final float stopX, final float stopY) {
      final int dx = (int)(startX - stopX);
      final int dy = (int)(startY - stopY);
      return (float)(Math.sqrt((dx*dx) + (dy*dy)));
   }
}